TcaplusDB Client - Select Command (Query Local Indexes)
For TcaplusDB Client Instructions, see Document.
1. Function Descriptions
Query all data under the index entry according to the values of all index fields of a local index specified by the user. It supports to query all field values or partial field values of the all data. If there are no matching records, an error will be returned.
Before querying a local index, you must first confirm that the corresponding Local Index has been defined in the table.
If you need to modify the records in the queried file and then update them to the server, use the load command.
Please note that for the List table, the load command will directly insert a new record. If you need to update the original record on the server, use the update command and specify the index.
Please note that the file name for saving query results cannot start with a number.
2. Initial Version
3.40.0
3. Command Syntax
select index_key1, index_key2, key3, value1, value2 [into result.csv] from table [where index_key1 = 1 and index_key2 = "abc"] [\P] [\G] [\S] [using tdr] [encode]
select * [into result.xml] from table [where index_key1 = 1 and index_key2 = "abc"] using tdr [\P];
Parameter description:
Parameter | PB Table | TDR Table | Required |
---|---|---|---|
table | Table name | Table name | Yes |
index_key | Index field name. The values of all index fields must be specified | Index field name. The values of all index fields must be specified | Yes |
key/value | field name | field name | At least one or * |
\P | Print delay data | Print delay data | No |
\G | Vertical printing | Vertical printing | No |
\S | Read data from copy | Read data from copy | No. If not specified, it is the default to read data from the primary replica |
\N | Do not print field names | Do not print field names | No. If not specified, it is the default to print field names |
\A | Append query results to a file | Append query results to a file | No. If not specified, it is the default to overwrite the query results to a file |
into | Export data to file | Export data to file | No |
using tdr | Do not support | If this parameter is required, it needs to specify the TDR file corresponding to the target table through the startup parameters at the time of starting the TcaplusDB Client. | No |
encode | Not supported (carriage return or invisible characters have been preprocessed) | After specifying this parameter, the dump command will encode the string type field value containing carriage return characters or invisible characters into BASE64 before outputting. Note: This parameter takes effect only when it is specified using tdr |
No |
In addition to specifying the partial keys in the where statement, versions after 3.55.0 also support the use of
AND
, combined with more flexible filter conditions. See Detailed Syntax.
4. Command Example
See Table Definition Example for table definition.
tcaplus> select * from test_table where gameid=1234 and itemid=12323;
+------+------+----------+------+----+-----+
|gameid|itemid|name |typeid|Data|uname|
+------+------+----------+------+----+-----+
|1234 |12323 |"testname"|0 |9 |"ab" |
+------+------+----------+------+----+-----+
1 records selectd, select time: 9802 us
tcaplus> select uname from test_table where gameid=1234 and itemid=12323;
+------+------+----------+-----+
|gameid|itemid|name |uname|
+------+------+----------+-----+
|1234 |12323 |"testname"|"ab" |
+------+------+----------+-----+
1 records selectd, select time: 9457 us
5. Common Errors
Refer to Common Errors.
6. Related Documents
[TDR Generic Table][C++ SDK] Interface Description for Querying Local Index.
[TDR Generic Table] [Java SDK] Interface Description for Querying Local Index.
[TDR Generic Table][Go SDK] Interface Description for Querying Local Index.
[PB Generic Table][C++ SDK] Interface Description for Querying Local Index.
[PB Generic Table][Go SDK] Interface Description for Querying Local Index.
[PB Generic Table][RESTFul API] Interface Description for Querying Local Index.